package com.aek.aekdroid.help;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Set;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.aek.aekdroid.BaseActivity;
import com.aek.aekdroid.R;

public class HelpMatchActivity extends BaseActivity {

	private LinearLayout helpList;
	LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.help_details);
		helpList = (LinearLayout) findViewById(R.id.help_itemsList);
		createMap();
	}

	private void createMap() {
		map.put("goal", getString(R.string.help_goal));
		map.put("yellow", getString(R.string.help_yellow));
		map.put("yellow_red", getString(R.string.help_yellowRed));
		map.put("red", getString(R.string.help_red));
		map.put("in", getString(R.string.help_in));
		map.put("out", getString(R.string.help_out));
		map.put("post", getString(R.string.help_post));
		map.put("lost_penalty", getString(R.string.help_lostPenalty));
		LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		Set<String> set = map.keySet();
		for (Iterator<String> iterator = set.iterator(); iterator.hasNext();) {
			String key = (String) iterator.next();
			String value = map.get(key);
			View vi = inflater.inflate(R.layout.help_item, null);
			ImageView imView = (ImageView) vi.findViewById(R.id.help_item_icon);
			TextView tView = (TextView) vi.findViewById(R.id.help_item_text);
			tView.setText(value);
			int r = HelpMatchActivity.this.aek.getResources().getIdentifier(key, "drawable", "com.aek.aekdroid");
			imView.setImageResource(r);
			helpList.addView(vi);

		}

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		menu.removeItem(R.id.menu_update);
		menu.removeItem(R.id.menu_purge);
		menu.removeItem(R.id.menu_checkUpdate);
		menu.removeItem(R.id.menu_help);
		return true;
	}
}
